package com.service.impl;

import java.util.List;
import java.util.Map;

import org.apache.log4j.Logger;

import com.bean.ParkManager;
import com.bean.Userinfo;
import com.dao.ManagerAndUserinfoDao;
import com.service.StatCumulativeUserService;
import com.tool.RegexTool;

public class StatCumulativeUserServiceImpl implements StatCumulativeUserService {
	private static final Logger log = Logger.getLogger(StatCumulativeUserServiceImpl.class);
	private ManagerAndUserinfoDao dao;
	@Override
	public Double[][] queryByMonth(Map<Double, Double> summanager,
			String monthtime) throws Exception {
		if(RegexTool.checkMonth(monthtime)){
			return dao.queryByMonth(summanager, monthtime);
		}else{
			log.error(this.getClass()+".queryByYear() 日期错误");
			return null;// "日期错误";
		}
	}

	@Override
	public Double[][] queryByYear(Map<Double, Double> summanager,
			 String yeartime) throws Exception {
		if(RegexTool.checkYear(yeartime)){
			return dao.queryByYear(summanager, yeartime);
		}else{
			log.error(this.getClass()+".queryByYear() 日期错误");
			return null;// "日期错误";
		}
	}

	public ManagerAndUserinfoDao getDao() {
		return dao;
	}

	public void setDao(ManagerAndUserinfoDao dao) {
		this.dao = dao;
	}

	@Override
	public Double[][] queryByMonths(Map<Double, Double> sumuserinfo,
			String monthtime) throws Exception {
		if(RegexTool.checkMonth(monthtime)){
			return dao.queryByMonths(sumuserinfo, monthtime);
		}else{
			log.error(this.getClass()+".queryByYear() 日期错误");
			return null;// "日期错误";
		}
	}

	@Override
	public Double[][] queryByYeasr(Map<Double, Double> sumuserinfo,
			String yeartime) throws Exception {
		if(RegexTool.checkYear(yeartime)){
			return dao.queryByYears(sumuserinfo, yeartime);
		}else{
			log.error(this.getClass()+".queryByYear() 日期错误");
			return null;// "日期错误";
		}
	}

}
